package com.whfp.coky.ui.main

import com.scwang.smart.refresh.layout.api.RefreshLayout
import com.scwang.smart.refresh.layout.listener.OnRefreshListener
import com.whfp.coky.databinding.ActivityDruggerTaskCountBinding
import com.whfp.coky.other.Constants
import com.whfp.coky.ui.base.BaseActivity
import com.whfp.coky.ui.main.model.DruggerBean
import com.whfp.coky.ui.main.vm.DuggerTaskCountVM

/**
 *
 * 戒毒人员任务统计
 * created by coky on 2022/3/14
 */
class DuggerTaskCountAct :BaseActivity<DuggerTaskCountVM, ActivityDruggerTaskCountBinding>(){

    var isManId : Boolean = false//判断是否与ID进来

    override fun initView() {
        (getBundle()?.getSerializable(Constants.BEAN) as DruggerBean)?.let {
            vBinding.tvDuggerName.text = "人员:${it.realName}"
            vModel.manIdLD.value = it.id
            isManId = it.id != null
        }

        vBinding.refreshLayoutTaskCount.setOnRefreshListener(object : OnRefreshListener {
            override fun onRefresh(refreshLayout: RefreshLayout) {
               if (isManId) vModel.httpCount(false) else toast("参数Error..")
            }
        })
        vBinding.refreshLayoutTaskCount.setEnableLoadMore(false)
    }

    override fun initData() {
    }

}